package DataAccess;

//////////////////////////////////////////////////////////////////////////
// �� �� ��: QiShu.cs
// �� �� ��: otyg
// ��������: DateTime.Now();
// ��    ��: ��װ���ݱ�[QiShu]��ز���
// ģ���޸�: 
//     2006-11-17  ֧��ChangePage�ؼ���ֻװ�ص�ǰҳ���ݹ���
//     2006-10-28  ����ͨ��DataRowView���쵥��������
//     2006-10-16  ���뼯�ϲ���foreach/Add/Remove�ȹ���,����Transaction����
// ��    Ȩ: ���������  QQ:1775068  
//////////////////////////////////////////////////////////////////////////
/** 
 Data Access Layer Object Of QiShu
*/
public class QiShu extends DataAccessBase
{
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ����ͻ���
	public QiShu()
	{
		super();
		_DataRow.setItem("Id", 0);
		_DataRow.setItem("CaiZhong_Id", 0);
		_DataRow.setItem("QiHao", "");
		_DataRow.setItem("Exp_Upload", java.time.LocalDateTime.MIN);
		_DataRow.setItem("Exp_Buy", java.time.LocalDateTime.MIN);
		_DataRow.setItem("addTime", java.time.LocalDateTime.MIN);
		_DataRow.setItem("kaijTime", java.time.LocalDateTime.MIN);
		_DataRow.setItem("kaij", "");
		_DataRow.setItem("kaijDetail", "");
		_DataRow.setItem("Qihao_1", 0);
		_DataRow.setItem("Qihao_2", 0);
		_DataRow.setItem("Zt", "");
		_DataRow.setItem("beizhu", "");
	}
	public QiShu(DataRow dataRow)
	{
		super(dataRow);
	}
	public QiShu(DataRowView dataRowView)
	{
		super(dataRowView);
	}
	@Override
	protected DataRow BuildRow()
	{
		DataTable dt = new DataTable();
		dt.Columns.Add("Id",Integer.class);
		dt.Columns.Add("CaiZhong_Id",Integer.class);
		dt.Columns.Add("QiHao",String.class);
		dt.Columns.Add("Exp_Upload",java.time.LocalDateTime.class);
		dt.Columns.Add("Exp_Buy",java.time.LocalDateTime.class);
		dt.Columns.Add("addTime",java.time.LocalDateTime.class);
		dt.Columns.Add("kaijTime",java.time.LocalDateTime.class);
		dt.Columns.Add("kaij",String.class);
		dt.Columns.Add("kaijDetail",String.class);
		dt.Columns.Add("Qihao_1",Integer.class);
		dt.Columns.Add("Qihao_2",Integer.class);
		dt.Columns.Add("Zt",String.class);
		dt.Columns.Add("beizhu",String.class);
		return dt.NewRow();
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ����ͻ���
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ����
	public final DataRow getDataRow()
	{
		return super._DataRow;
	}
	public final int getId()
	{
		return Integer.parseInt(_DataRow.getItem("Id").toString());
	}
	public final void setId(int value)
	{
		_DataRow.setItem("Id", value);
	}
	public final int getCaiZhong_Id()
	{
		return Integer.parseInt(_DataRow.getItem("CaiZhong_Id").toString());
	}
	public final void setCaiZhong_Id(int value)
	{
		_DataRow.setItem("CaiZhong_Id", value);
	}
	public final String getQiHao()
	{
		return _DataRow.getItem("QiHao").toString();
	}
	public final void setQiHao(String value)
	{
		_DataRow.setItem("QiHao", value);
	}
	public final java.time.LocalDateTime getExp_Upload()
	{
		return java.time.LocalDateTime.parse(_DataRow.getItem("Exp_Upload").toString());
	}
	public final void setExp_Upload(java.time.LocalDateTime value)
	{
		_DataRow.setItem("Exp_Upload", value);
	}
	public final java.time.LocalDateTime getExp_Buy()
	{
		return java.time.LocalDateTime.parse(_DataRow.getItem("Exp_Buy").toString());
	}
	public final void setExp_Buy(java.time.LocalDateTime value)
	{
		_DataRow.setItem("Exp_Buy", value);
	}
	public final java.time.LocalDateTime getaddTime()
	{
		return java.time.LocalDateTime.parse(_DataRow.getItem("addTime").toString());
	}
	public final void setaddTime(java.time.LocalDateTime value)
	{
		_DataRow.setItem("addTime", value);
	}
	public final java.time.LocalDateTime getkaijTime()
	{
		return java.time.LocalDateTime.parse(_DataRow.getItem("kaijTime").toString());
	}
	public final void setkaijTime(java.time.LocalDateTime value)
	{
		_DataRow.setItem("kaijTime", value);
	}
	public final String getkaij()
	{
		return _DataRow.getItem("kaij").toString();
	}
	public final void setkaij(String value)
	{
		_DataRow.setItem("kaij", value);
	}
	public final String getkaijDetail()
	{
		return _DataRow.getItem("kaijDetail").toString();
	}
	public final void setkaijDetail(String value)
	{
		_DataRow.setItem("kaijDetail", value);
	}
	public final int getQihao_1()
	{
		return Integer.parseInt(_DataRow.getItem("Qihao_1").toString());
	}
	public final void setQihao_1(int value)
	{
		_DataRow.setItem("Qihao_1", value);
	}
	public final int getQihao_2()
	{
		return Integer.parseInt(_DataRow.getItem("Qihao_2").toString());
	}
	public final void setQihao_2(int value)
	{
		_DataRow.setItem("Qihao_2", value);
	}
	public final String getZt()
	{
		return _DataRow.getItem("Zt").toString();
	}
	public final void setZt(String value)
	{
		_DataRow.setItem("Zt", value);
	}
	public final String getbeizhu()
	{
		return _DataRow.getItem("beizhu").toString();
	}
	public final void setbeizhu(String value)
	{
		_DataRow.setItem("beizhu", value);
	}
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ����
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ��������
	protected final boolean DeleteByCondition(String condition)
	{
		String sql = "" + "\r\n" +
"				Delete From QiShu" + "\r\n" +
"				WHERE " + condition;
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		super.ExecuteSQL(sql);
//#else
		try
		{
			super.ExecuteSQL(sql);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
		return true;
	}
	public final boolean Delete(int Id)
	{
		String condition = "Id=" + String.valueOf(Id);
		return DeleteByCondition(condition);
	}
	public final boolean Delete()
	{
		String condition = "Id=" + String.valueOf(getId());
		return DeleteByCondition(condition);
	}
	public final boolean Insert()
	{
			String sql = "" + "\r\n" +
"				Insert Into QiShu (" + "\r\n" +
"\r\n" +
"					CaiZhong_Id," + "\r\n" +
"					QiHao," + "\r\n" +
"					Exp_Upload," + "\r\n" +
"					Exp_Buy," + "\r\n" +
"					addTime," + "\r\n" +
"					kaijTime," + "\r\n" +
"					kaij," + "\r\n" +
"					kaijDetail," + "\r\n" +
"					Qihao_1," + "\r\n" +
"					Qihao_2," + "\r\n" +
"					Zt," + "\r\n" +
"					beizhu" + "\r\n" +
"				) Values (" + "\r\n" +
"					" + "\r\n" +
"\r\n" +
"					" + getCaiZhong_Id() + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getQiHao()) + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getExp_Upload().toString()) + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getExp_Buy().toString()) + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getaddTime().toString()) + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getkaijTime().toString()) + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getkaij()) + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getkaijDetail()) + "," + "\r\n" +
"					" + getQihao_1() + "," + "\r\n" +
"					" + getQihao_2() + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getZt()) + "," + "\r\n" +
"					" + Helper.ToSQLParamStr(getbeizhu()) + "\r\n" +
"				)";
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		super.ExecuteSQL(sql);
//#else
		try
		{
			super.ExecuteSQL(sql);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
		return true;
	}
	protected final boolean SelectByCondition(String condition)
	{
		String sql = "" + "\r\n" +
"				Select" + "\r\n" +
"					Id," + "\r\n" +
"					CaiZhong_Id," + "\r\n" +
"					QiHao," + "\r\n" +
"					Exp_Upload," + "\r\n" +
"					Exp_Buy," + "\r\n" +
"					addTime," + "\r\n" +
"					kaijTime," + "\r\n" +
"					kaij," + "\r\n" +
"					kaijDetail," + "\r\n" +
"					Qihao_1," + "\r\n" +
"					Qihao_2," + "\r\n" +
"					Zt," + "\r\n" +
"					beizhu" + "\r\n" +
"				  From QiShu" + "\r\n" +
"				 Where " + condition + "\r\n" +
"			";
		DataTable dt;
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		dt = super.GetDataTable(sql);
//#else
		try
		{
			dt = super.GetDataTable(sql);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
		try
		{
			_DataRow = dt.Rows[0];
		}
		catch (java.lang.Exception e2)
		{
			return false;
		}
		return true;
	}
	public final boolean SelectByPk(int Id)
	{
		String condition = "1=1" + "\r\n" +
"				   And Id=" + String.valueOf(Id) + "\r\n" +
"			";
		return SelectByCondition(condition);
	}
	public final boolean Update()
	{
		String sql = "" + "\r\n" +
"				Update QiShu SET" + "\r\n" +
"					CaiZhong_Id=" + getCaiZhong_Id() + "," + "\r\n" +
"					QiHao=" + Helper.ToSQLParamStr(getQiHao()) + "," + "\r\n" +
"					Exp_Upload=" + Helper.ToSQLParamStr(getExp_Upload().toString()) + "," + "\r\n" +
"					Exp_Buy=" + Helper.ToSQLParamStr(getExp_Buy().toString()) + "," + "\r\n" +
"					addTime=" + Helper.ToSQLParamStr(getaddTime().toString()) + "," + "\r\n" +
"					kaijTime=" + Helper.ToSQLParamStr(getkaijTime().toString()) + "," + "\r\n" +
"					kaij=" + Helper.ToSQLParamStr(getkaij()) + "," + "\r\n" +
"					kaijDetail=" + Helper.ToSQLParamStr(getkaijDetail()) + "," + "\r\n" +
"					Qihao_1=" + getQihao_1() + "," + "\r\n" +
"					Qihao_2=" + getQihao_2() + "," + "\r\n" +
"					Zt=" + Helper.ToSQLParamStr(getZt()) + "," + "\r\n" +
"					beizhu=" + Helper.ToSQLParamStr(getbeizhu()) + "\r\n" +
"				Where 1=1" + "\r\n" +
" 				  And Id= " + String.valueOf(getId()) + "\r\n" +
"				";
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		return (super.ExecuteSQL(sql) == 1);
//#else
		try
		{
			return (super.ExecuteSQL(sql) == 1);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
	}

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ��������
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#region ���淽��
	public final boolean SelectNewRightNUM()
	{
		String sql = "select" + "\r\n" +
"					*" + "\r\n" +
"				  From QiShu" + "\r\n" +
"				 Where kaij <> '' order by QiHao desc ";
		DataTable dt;
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		dt = super.GetDataTable(sql);
//#else
		try
		{
			dt = super.GetDataTable(sql);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
		try
		{
			_DataRow = dt.Rows[0];
		}
		catch (java.lang.Exception e2)
		{
			return false;
		}
		return true;
	}


	public final boolean DeleteByCaizhongidAndQihao(String Czid, String Qihao)
	{
		String condition = " caizhong_id =" + Helper.ToSQLParamStr(Czid) + " And qihao =" + Helper.ToSQLParamStr(Qihao);
		return DeleteByCondition(condition);
	}
	//���ý���״̬���ķ���


	public final boolean UpdateStates(String zhuangTai, String qihao)
	{
		String sql = "" + "\r\n" +
"				Update QiShu SET" + "\r\n" +
"					zt=" + Helper.ToSQLParamStr(zhuangTai) + "," + "\r\n" +
"					beizhu=" + Helper.ToSQLParamStr(getbeizhu()) + "\r\n" +
"				Where 1=1" + "\r\n" +
" 				  And qihao= " + Helper.ToSQLParamStr(qihao);

//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		return (super.ExecuteSQL(sql) == 1);
//#else
		try
		{
			return (super.ExecuteSQL(sql) == 1);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
	}



	public final boolean UpdateDetailByQihao(String Qihao)
	{
		String sql = "" + "\r\n" +
"				Update QiShu SET" + "\r\n" +
"					kaij=" + Helper.ToSQLParamStr(getkaij()) + "," + "\r\n" +
"					kaijDetail= " + Helper.ToSQLParamStr(getkaijDetail()) + " Where 1=1" + "\r\n" +
" 				  And qihao = " + Helper.ToSQLParamStr(Qihao) + "\r\n" +
"				";
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		return (super.ExecuteSQL(sql) == 1);
//#else
		try
		{
			return (super.ExecuteSQL(sql) == 1);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
	}


	public final boolean SelectByQihao(String qihao)
	{
		String condition = "1=1" + "\r\n" +
"				   And Qihao=" + Helper.ToSQLParamStr(qihao);
		return SelectByCondition(condition);
	}

	public final boolean UpdateByQihao(String Qihao)
	{

		String sql = "" + "\r\n" +
"				Update QiShu SET" + "\r\n" +
"					kaij=" + Helper.ToSQLParamStr(getkaij()) + " " + "\r\n" +
"			    	Where 1=1" + "\r\n" +
" 				    And Qihao = " + Helper.ToSQLParamStr(Qihao);
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		return (super.ExecuteSQL(sql) == 1);
//#else
		try
		{
			return (super.ExecuteSQL(sql) == 1);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
	}

	public final boolean UpdateByQihaoAndCaizhongid(String Qihao, String CaizhongId, String Kaij, String AddTime)
	{
		String sql = "" + "\r\n" +
"				Update QiShu SET" + "\r\n" +
"					" + "\r\n" +
"					kaij=" + Helper.ToSQLParamStr(Kaij) + ", Addtime = '" + AddTime + "' Where  Qihao = " + "\r\n" +
"					" + Helper.ToSQLParamStr(Qihao) + "\r\n" +
"					And CaiZhong_Id = " + Helper.ToSQLParamStr(CaizhongId) + "" + "\r\n" +
"				";
//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
//#if(DEBUG)
		return (super.ExecuteSQL(sql) == 1);
//#else
		try
		{
			return (super.ExecuteSQL(sql) == 1);
		}
		catch (java.lang.Exception e)
		{
			return false;
		}
//#endif
	}


	/** 
	 ����Qh1 Qh2 ��ѯ.������ݿ��Ƿ��Ѵ��ڸ�������
	 
	 @param CaiZhong_id
	 @param qihao_1
	 @param qihao_2
	 @return 
	*/

	public final boolean SelectByCaizhongQh1Qh2(int CaiZhong_id, int qihao_1, int qihao_2)
	{
		String condition = "" + "\r\n" +
"				   CaiZhong_id=" + String.valueOf(CaiZhong_id) + "\r\n" +
"				   And qihao_1 =" + String.valueOf(qihao_1) + " " + "\r\n" +
"				   And qihao_2 =" + String.valueOf(qihao_2);
		return SelectByCondition(condition);
	}
	/** 
	 ȡ�����������Ϊ�յ�topX
	 
	 @param x
	 @return 
	*/





//C# TO JAVA CONVERTER TODO TASK: There is no preprocessor in Java:
		///#endregion ���淽��
}